﻿// Sheego.Service.X400
// Copyright(C) 2015 Schwab Versand GmbH
//
// This source file is subject to the Microsoft Public License(Ms-PL).
// http://www.opensource.org/licenses/ms-pl.html
// All other rights reserved.

using Sheego.Service.X400.Scheduler.Shared;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Sheego.Service.X400.Scheduler.Impl
{
    class SchedulerLogger : ISchedulerLogger
    {
        private string sSource = "Sheego.Service.X400.Scheduler";

        #region ISchedulerLogger Members

        public string EventSouce
        {
            get
            {
                if (!EventLog.SourceExists(sSource))
                    EventLog.CreateEventSource(sSource, "Application");
                return sSource;
            }
        }


        public void Info(string format, params object[] args)
        {
            var Message = String.Format(format, args);
            EventLog.WriteEntry(EventSouce, Message, EventLogEntryType.Information);
        }

        public void Error(string format, params object[] args)
        {
            var Message = String.Format(format, args);
            EventLog.WriteEntry(EventSouce, Message, EventLogEntryType.Error);
        }

        #endregion

    }
}
